package com.equipment;

import com.util.EncodingUtil;

/**
 * 国标读车辆信息C2
 * @author Administrator
 *
 */
public class ReadChineseVehicleRequest {

	private String STX = "55AA"; // 帧开始标志
	private String RSCTL = "00"; // 串口帧序列号
	private String Length = ""; // 数据长度
	private String code = "FD"; // 代码
	private String broadening = "C2"; // 扩展代码
	private String PsamVerType = "";//PSAM卡解密车辆密钥类型，1表示5903，2表示3903

	private String bcc = "";// 异或校验

	/**
	 * 拼接数据帧
	 * @return
	 */
	public String getReadChineseVehicleRequest(String psamVerType) {
		this.PsamVerType = psamVerType;
		Length = EncodingUtil.desToHex((broadening+PsamVerType).length()/2,4);
		String DATA = RSCTL + Length + code + broadening+PsamVerType;
		bcc = EncodingUtil.yihuo(EncodingUtil.change(DATA));
		return  STX + DATA + bcc;
	}
}
